//
//  MainController.h
//  Simple Tagger
//
//  Created by Thomas Bröckers on 21.02.08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <SearchEngine.h>
#import <FileHandler.h>
#import <ResultEntry.h>

extern NSString* const STLastRenamingMaskKey;
extern NSString* const STStatusChangedNotification;

@interface MainController : NSResponder {
    IBOutlet NSTextField *artist;
    IBOutlet NSTextField *album;
    IBOutlet NSTextField *publicationYear;
    IBOutlet NSTextField *genre;
    IBOutlet NSTextField *tracks;
    IBOutlet NSTextField *label;
    IBOutlet NSTextField *discs;
    IBOutlet NSImageView *cover;
    IBOutlet NSTextField *keywords;
    IBOutlet NSTextField *renaming;
    IBOutlet NSTextField *preview;
    IBOutlet NSTextField *trackTitle;
    IBOutlet NSTextField *trackArtist;
    IBOutlet NSMatrix *searchSelection;
    IBOutlet NSTableView *resultTableView;
    IBOutlet NSTableView *trackListView;
    IBOutlet NSTableView *fileListView;
    IBOutlet NSButton *tagButton;
    IBOutlet NSButton *renameButton;
    IBOutlet NSTextField *status;
    IBOutlet NSView *statusView;
    NSMutableArray *resultList;
    NSMutableArray *trackItems;
    NSMutableArray *songs;
    BOOL highlighted;
}

+ (void) initialize;
- (IBAction) processTagging:(id) sender;
- (IBAction) processRenaming:(id) sender;
- (IBAction) addAlbumInformation:(id) sender;
- (IBAction) addTrackItem:(id) sender;
- (IBAction) dropTags:(id) sender;
- (IBAction) clearAll:(id) sender;
- (IBAction) clearFiles:(id) sender;

- (int)numberOfRowsInTableView:(NSTableView *)tableView;

- (id)              tableView:(NSTableView *) tableView 
    objectValueForTableColumn:(NSTableColumn *) tableColumn 
                          row:(int) row;

- (NSDragOperation) tableView:(NSTableView*) tv 
                 validateDrop:(id <NSDraggingInfo>) info 
                  proposedRow:(int) row 
        proposedDropOperation:(NSTableViewDropOperation) op;

- (void) tableView:(NSTableView *) tableView
    setObjectValue:(id) object
    forTableColumn:(NSTableColumn *) tableColumn
               row:(int) row;

- (BOOL)     tableView:(NSTableView *) tv 
  writeRowsWithIndexes:(NSIndexSet *) rowIndexes 
          toPasteboard:(NSPasteboard*) pboard;

- (BOOL)    tableView:(NSTableView*) tv 
           acceptDrop:(id <NSDraggingInfo>) info 
                  row:(int) row 
        dropOperation:(NSTableViewDropOperation) op;

- (void) keyDown:(NSEvent *) event;

- (NSMutableArray *) trackItems;
- (NSMutableArray *) resultList;
- (NSMutableArray *) songs;
- (IBAction) getSearchResult:(id)sender;

- (void) deleteSelectedRowsInTableView:(NSTableView *) tableView
                          ForBaseArray:(NSMutableArray *) baseArray;

- (void) tableViewSelectionDidChange:(NSNotification *) aNotification;
- (void)controlTextDidEndEditing:(NSNotification *) obj;
- (void) controlTextDidChange:(NSNotification *) aNotification;
- (void) updatePreview;
- (void) clearTableViewsAndDataSources;
- (void) clearDetails;
- (void) refreshTableView:(NSTableView *) tableView;
- (void) generateNewTrackItem:(NSString *) trackName
                  trackArtist:(NSString *) newArtist;
- (void) generateNewAlbumEntryForArtist:(NSString *) artistName
                                  Album:(NSString *) albumName
                                   Year:(NSString *) year
                                  Genre:(NSString *) genreName
                                  Label:(NSString *) labelName
                                 Tracks:(NSString *) trackNumber
                                  Discs:(NSString *) discNumber;

- (void) clearAdditionalDetails;
- (void) writeTagsFromFilesInTableViews;
- (void) saveRenamingMask;
- (void) switchStatus:(NSString *) newStatus;

@end
